#include <stdio.h>

void getMinMax(int arr[], int length, int *p_min, int *p_max)
{

    *p_max = arr[0];
    *p_min = arr[0];
    for (int i = 1; i < length; i++)
    {
        int num = arr[i];
        if (num > *p_max)
        {
            *p_max = num;
        }
        if (num < *p_min)
        {
            *p_min = num;
        }
    }
};
int main()
{
    int a[] = {1, 2, 3};
    int min, max;
    int length = sizeof(a) / sizeof(a[0]);
    getMinMax(a, length, &min, &max);
    printf("min is %d\n", min);
    printf("max is %d\n", max);
    return 0;
}
